const Koa = require('koa');
const Router = require('koa-router');

const app = new Koa();
const router = new Router();

router.get('/', (ctx, next) => {
    ctx.body = 'hello word';
});

router.get('/test', (ctx, next) => {
    ctx.body = 'test word';
});

app.use(router.routes()).use(router.allowedMethods());

const port = 3000;
app.listen(port, err => {
    if (err) {
        console.error(err);
    }
    else {
        console.info(`server start, listening ${port}...`);
    }
});